<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <script src="../org/angular.min.js"></script>
</head>
<body>
<div ng-app="hd" ng-controller="ctrl">
    {{data}}
    <button ng-click="orderBy()">控制器中使用过滤器</button>
</div>
<script>
    var m = angular.module('hd', []);
    m.controller('ctrl', ['$scope','$filter', function ($scope,$filter) {
        $scope.data=[
            {id:1,click:100,title:'后盾人'},
            {id:2,click:200,title:'PHP'},
            {id:3,click:300,title:'后盾网'},
        ];
        $scope.orderBy=function(){
            $scope.data = $filter('orderBy')($scope.data,'id',true);
        }
    }]);
</script>
</body>
</html>